<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>analyse</title>
</head>
<body>
<div id="main" style="height:800px;"></div>
<script src="/js/echarts/echarts.min.js"></script>
<script src="/js/jquery.min.js"></script>
<script language="JavaScript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'), 'dark');
    // 指定图表的配置项和数据
    option = {
        legend: {},
        tooltip : {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        dataZoom:{},
        dataset: {
            source: [/*
                ['product', '2015', '2016', '2017'],    //title
                ['Matcha Latte', 43.3, 85.8, 93.7],     //x轴
                ['Milk Tea', 83.1, 73.4, 55.1],         //y轴
                ['Cheese Cocoa', 86.4, 65.2, 82.5],     //y轴
                ['Walnut Brownie', 72.4, 53.9, 39.1]    //y轴
            */]
        },
        xAxis: {type: 'category'},
        yAxis: {},
        series: [
            {type: 'line',
                smooth: true
            },
            {type: 'line',
                smooth: true},
            {type: 'line',
                smooth: true}
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

    $.ajax({
        url : '/getElecs',
        data : {
            companyCode : 10001,
            cdid : 1,
            begin : '2018-12-1 12:00:00',
            end : '2019-7-1 12:00:00'
        },
        success : function(data){
            myChart.setOption({
                dataset:{
                    source:data.data
                }
            });
        }
    });


</script>
</body>
</html>